package com.net.xpay.core.dao.safePay;

import com.net.xpay.core.domain.safePay.SafePayBatch;
import com.net.xpay.core.dto.AccountAmountCountDto;
import com.net.xpay.core.model.*;
import com.net.common.annotation.DataShard;
import com.net.common.dao.Page;
import com.net.common.dao.VersionedMapper;
import com.net.xpay.core.model.SafePayTransDailyStatModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@DataShard("")
@Repository
public interface SafePayBatchMapper extends VersionedMapper<Long, SafePayBatch> {
    List<Long> listNeedTransBatch();

    List<SafePayBatch> search(@Param("searchModel") SafePayBatchSearchModel searchModel, @Param("page") Page page);

    long searchCount(@Param("searchModel") SafePayBatchSearchModel searchModel);

    List<Long> listIds(@Param("searchModel")  SafePayBatchSearchModel searchModel);

    UserSafePayTransStatModel countAmountAndTimesOfSuccess(@Param("userId")Long userId, @Param("dayStart") LocalDateTime dayStart, @Param("dayEnd") LocalDateTime dayEnd);

    CompanyBillDailyStatModel statDailyCompanyBill(@Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime);

    SafePayBatchStatResultModel statLevelOneSuccessSafePayBatch(@Param("partnerId") Long partnerId, @Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime);

    SafePayBatchStatResultModel statLevelTwoSuccessSafePayBatch(@Param("partnerId") Long partnerId, @Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime);

    BigDecimal getTransferLimit(@Param("minEndTime")LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime,@Param("userId") Long userId,@Param("safePayBookAccountId") Long safePayBookAccountId);

    UserSafePayTransStatCommonModel countAmountAndTimesOfSuccessBank(@Param("userId")Long userId, @Param("dayStart") LocalDateTime dayStart, @Param("dayEnd") LocalDateTime dayEnd);

    UserSafePayTransStatCommonModel countAmountAndTimesOfSuccessAlipay(@Param("userId")Long userId,@Param("dayStart") LocalDateTime dayStart,@Param("dayEnd") LocalDateTime dayEnd);

    UserSafePayTransStatCommonModel countAmountAndTimesOfSuccessNotFreeBank(@Param("userId")Long userId,@Param("dayStart") LocalDateTime dayStart,@Param("dayEnd") LocalDateTime dayEnd);

    UserSafePayTransStatCommonModel countAmountAndTimesOfSuccessNotFreeAlipay(@Param("userId")Long userId,@Param("dayStart") LocalDateTime dayStart,@Param("dayEnd") LocalDateTime dayEnd);

    List<SafePayBatch> list(@Param("searchModel") SafePayBatchSearchModel searchModel);

    PartnerUserSafePayTransDayStatModel sumPartnerUserSafePayTransDay(@Param("userId")Long userId,@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    PartnerUserSafePayTransDayStatModel sumPartnerSafePayTransDay(@Param("partnerId")Long partnerId,@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    SafePayTransDailyStatModel statActivePartnerCount(@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    CompanySafePayTransDayStatModel sumCompanySafePayTransDay(@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    long sumTotalVeryAlipayUserCount(@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    long sumUserTotalVeryAlipayUserCount(@Param("userId")Long userId,@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    SafePayTransBankDailyStatModel statSafePayTransBankAmount(@Param("minEndTime") LocalDateTime minEndTime,@Param("maxEndTime") LocalDateTime maxEndTime);

    AccountAmountCountDto sumSafeSuccessAmount(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("userId") Long userId,@Param("dayTime") LocalDateTime dayTime);
}
